Skip to content

fix: Implement IP-based rate limiting with Redis for DDoS protection - #571

Open
Darktan242 wants to merge 2 commits into
Abdulazeem-code:mainfrom
Darktan242:solver/issue-492-30-a0
Open

fix: Implement IP-based rate limiting with Redis for DDoS protection#571
Darktan242 wants to merge 2 commits into
Abdulazeem-code:mainfrom
Darktan242:solver/issue-492-30-a0

Conversation

@Darktan242

Copy link
Copy Markdown

Summary

Implemented IP-based rate limiting with Redis for DDoS protection in the stellar-payment-platform.

Changes made:

  1. server.js: Added a strict authLimiter for /auth endpoints (email OTP verification / login flow). This limiter:

    • Uses the same Redis-backed RedisStore as the global limiter, so limits are shared across all distributed Node instances.
    • Applies a much tighter budget (max 20 requests per 15-minute window) compared to the global limiter (max 100), protecting against brute-force attacks on auth/login endpoints.
    • Keys by client IP, which is appropriate for unauthenticated auth endpoints.
    • Returns the same standardized RATE_LIMITED error body and standard/legacy rate-limit headers.
  2. tests/rate-limit.test.js: Added a test verifying that the strict auth limiter rejects the 21st request to /auth/verify-email (429) even though the global limit is 100.

The global limiter already used RedisStore when a Redis client is available (existing code), satisfying the "Redis store configured for rate limiting" and "Global limits applied correctly across distributed nodes" acceptance criteria. The new auth limiter satisfies the "Specific strict limits for auth/login endpoints" criterion.

Changed files

  • stellar-payment-platform/server.js
  • stellar-payment-platform/tests/rate-limit.test.js

Test plan

Run the rate-limit test suite: cd stellar-payment-platform && npm test -- --testPathPattern=rate-limit (or npm test for the full suite). The new test verifies the strict auth limiter returns 429 on the 21st request to /auth/verify-email. Existing tests verify the global limiter still works with the Redis-backed store.

This PR was created as a draft by the issue solver bot. It will remain a
draft until repository CI passes.

Closes #492

@vercel

vercel Bot commented Aug 25, 2026

Copy link
Copy Markdown

@issue-solver-bot is attempting to deploy a commit to the Abdulazeem's projects Team on Vercel.

A member of the Team first needs to authorize it.

@drips-wave

drips-wave Bot commented Aug 25, 2026

Copy link
Copy Markdown

@Darktan242 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Darktan242
Darktan242 marked this pull request as ready for review August 26, 2026 00:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement IP-based rate limiting with Redis for DDoS protection

2 participants